import matplotlib.pyplot as plt
import numpy as np

plt.rcParams["font.sans-serif"] = ["STHeiti"]
numbers = [
    103,
    343,
    423,
    123,
    212,
    300,
    111,
    252,
    107,
    120,
    188,
    156,
    236,
    200,
    150,
    160,
]

# 订单尾号

tail = np.array(numbers) % 10
bin = np.arange(0, 10, 1)
ax = plt.subplot()
ax.hist(tail, bin, rwidth=0.8, align="left")

# 刻度
ax.set_xticks(bin, minor=False)
ax.set_xlim(min(bin) - 1, len(bin))
ax.set_ylim(min(tail), max(tail) + 1)
ax.set_xlabel("订单尾号")
ax.set_ylabel("杯数")
ax.set_title("爷爷不泡茶")

plt.show()
